﻿using System;
using System.Data;
using HRM.Common;

namespace HRM.BusinessLogic
{
    public class NhanSu_Info : Standard_Info
    {
        public NhanSu_Info()
        {
        }

        private int _NhanSu_ID;

        public int NhanSu_ID
        {
            get { return _NhanSu_ID; }
            set { _NhanSu_ID = value; }
        }

        private int _NhanSu_BranchID;

        public int NhanSu_BranchID
        {
            get { return _NhanSu_BranchID; }
            set { _NhanSu_BranchID = value; }
        }
        private string _NhanSu_SoSoBHXH;

        public string NhanSu_SoSoBHXH
        {
            get { return _NhanSu_SoSoBHXH; }
            set { _NhanSu_SoSoBHXH = value; }
        }
        private string _NhanSu_HoVaTen;

        public string NhanSu_HoVaTen
        {
            get { return _NhanSu_HoVaTen; }
            set { _NhanSu_HoVaTen = value; }
        }
        private bool _NhanSu_GioiTinh;

        public bool NhanSu_GioiTinh
        {
            get { return _NhanSu_GioiTinh; }
            set { _NhanSu_GioiTinh = value; }
        }
        private DateTime _NhanSu_NgaySinh;

        public DateTime NhanSu_NgaySinh
        {
            get { return _NhanSu_NgaySinh; }
            set { _NhanSu_NgaySinh = value; }
        }
        private int _NhanSu_DanToc;

        public int NhanSu_DanToc
        {
            get { return _NhanSu_DanToc; }
            set { _NhanSu_DanToc = value; }
        }
        private int _NhanSu_QuocGia;

        public int NhanSu_QuocGia
        {
            get { return _NhanSu_QuocGia; }
            set { _NhanSu_QuocGia = value; }
        }
        private string _NhanSu_DienThoai;

        public string NhanSu_DienThoai
        {
            get { return _NhanSu_DienThoai; }
            set { _NhanSu_DienThoai = value; }
        }
        private string _NhanSu_Email;

        public string NhanSu_Email
        {
            get { return _NhanSu_Email; }
            set { _NhanSu_Email = value; }
        }
        private string _NhanSu_SoCMT;

        public string NhanSu_SoCMT
        {
            get { return _NhanSu_SoCMT; }
            set { _NhanSu_SoCMT = value; }
        }
        private string _NhanSu_NoiCapCMT;

        public string NhanSu_NoiCapCMT
        {
            get { return _NhanSu_NoiCapCMT; }
            set { _NhanSu_NoiCapCMT = value; }
        }
        private DateTime _NhanSu_NgayCapCMT;

        public DateTime NhanSu_NgayCapCMT
        {
            get { return _NhanSu_NgayCapCMT; }
            set { _NhanSu_NgayCapCMT = value; }
        }
        private string _NhanSu_NoiKham;

        public string NhanSu_NoiKham
        {
            get { return _NhanSu_NoiKham; }
            set { _NhanSu_NoiKham = value; }
        }
        private string _NhanSu_MaBenhVien;

        public string NhanSu_MaBenhVien
        {
            get { return _NhanSu_MaBenhVien; }
            set { _NhanSu_MaBenhVien = value; }
        }
        private string _NhanSu_ChaMe;

        public string NhanSu_ChaMe
        {
            get { return _NhanSu_ChaMe; }
            set { _NhanSu_ChaMe = value; }
        }
        private string _NhanSu_ThanNhanKhac;

        public string NhanSu_ThanNhanKhac
        {
            get { return _NhanSu_ThanNhanKhac; }
            set { _NhanSu_ThanNhanKhac = value; }
        }
        private string _NhanSu_DiaChiKhaiSinh;

        public string NhanSu_DiaChiKhaiSinh
        {
            get { return _NhanSu_DiaChiKhaiSinh; }
            set { _NhanSu_DiaChiKhaiSinh = value; }
        }
        private string _NhanSu_PhuongKhaiSinh;

        public string NhanSu_PhuongKhaiSinh
        {
            get { return _NhanSu_PhuongKhaiSinh; }
            set { _NhanSu_PhuongKhaiSinh = value; }
        }
        private string _NhanSu_QuanKhaiSinh;

        public string NhanSu_QuanKhaiSinh
        {
            get { return _NhanSu_QuanKhaiSinh; }
            set { _NhanSu_QuanKhaiSinh = value; }
        }
        private string _NhanSu_ThanhPhoKhaiSinh;

        public string NhanSu_ThanhPhoKhaiSinh
        {
            get { return _NhanSu_ThanhPhoKhaiSinh; }
            set { _NhanSu_ThanhPhoKhaiSinh = value; }
        }
        private string _NhanSu_DiaChiHoKhau;

        public string NhanSu_DiaChiHoKhau
        {
            get { return _NhanSu_DiaChiHoKhau; }
            set { _NhanSu_DiaChiHoKhau = value; }
        }
        private string _NhanSu_PhuongHoKhau;

        public string NhanSu_PhuongHoKhau
        {
            get { return _NhanSu_PhuongHoKhau; }
            set { _NhanSu_PhuongHoKhau = value; }
        }
        private string _NhanSu_QuanHoKhau;

        public string NhanSu_QuanHoKhau
        {
            get { return _NhanSu_QuanHoKhau; }
            set { _NhanSu_QuanHoKhau = value; }
        }
        private string _NhanSu_ThanhPhoHoKhau;

        public string NhanSu_ThanhPhoHoKhau
        {
            get { return _NhanSu_ThanhPhoHoKhau; }
            set { _NhanSu_ThanhPhoHoKhau = value; }
        }
        private string _NhanSu_DiaChiLienHe;

        public string NhanSu_DiaChiLienHe
        {
            get { return _NhanSu_DiaChiLienHe; }
            set { _NhanSu_DiaChiLienHe = value; }
        }
        private string _NhanSu_PhuongLienHe;

        public string NhanSu_PhuongLienHe
        {
            get { return _NhanSu_PhuongLienHe; }
            set { _NhanSu_PhuongLienHe = value; }
        }
        private string _NhanSu_QuanLienHe;

        public string NhanSu_QuanLienHe
        {
            get { return _NhanSu_QuanLienHe; }
            set { _NhanSu_QuanLienHe = value; }
        }
        private string _NhanSu_ThanhPhoLienHe;

        public string NhanSu_ThanhPhoLienHe
        {
            get { return _NhanSu_ThanhPhoLienHe; }
            set { _NhanSu_ThanhPhoLienHe = value; }
        }
        private string _NhanSu_SoHopDong;

        public string NhanSu_SoHopDong
        {
            get { return _NhanSu_SoHopDong; }
            set { _NhanSu_SoHopDong = value; }
        }
        private DateTime _NhanSu_NgayKy;

        public DateTime NhanSu_NgayKy
        {
            get { return _NhanSu_NgayKy; }
            set { _NhanSu_NgayKy = value; }
        }
        private DateTime _NhanSu_NgayHieuLuc;

        public DateTime NhanSu_NgayHieuLuc
        {
            get { return _NhanSu_NgayHieuLuc; }
            set { _NhanSu_NgayHieuLuc = value; }
        }
        private string _NhanSu_LoaiHopDong;

        public string NhanSu_LoaiHopDong
        {
            get { return _NhanSu_LoaiHopDong; }
            set { _NhanSu_LoaiHopDong = value; }
        }
        private string _NhanSu_ChucVu;

        public string NhanSu_ChucVu
        {
            get { return _NhanSu_ChucVu; }
            set { _NhanSu_ChucVu = value; }
        }
        private decimal _NhanSu_LuongChinh;

        public decimal NhanSu_LuongChinh
        {
            get { return _NhanSu_LuongChinh; }
            set { _NhanSu_LuongChinh = value; }
        }
        private decimal _NhanSu_LuongKhac;

        public decimal NhanSu_LuongKhac
        {
            get { return _NhanSu_LuongKhac; }
            set { _NhanSu_LuongKhac = value; }
        }
        private decimal _NhanSu_PCChucVu;

        public decimal NhanSu_PCChucVu
        {
            get { return _NhanSu_PCChucVu; }
            set { _NhanSu_PCChucVu = value; }
        }
        private decimal _NhanSu_TNVK;

        public decimal NhanSu_TNVK
        {
            get { return _NhanSu_TNVK; }
            set { _NhanSu_TNVK = value; }
        }
        private decimal _NhanSu_TNNghe;

        public decimal NhanSu_TNNghe
        {
            get { return _NhanSu_TNNghe; }
            set { _NhanSu_TNNghe = value; }
        }
        private string _NhanSu_TangLuongChinh;

        public string NhanSu_TangLuongChinh
        {
            get { return _NhanSu_TangLuongChinh; }
            set { _NhanSu_TangLuongChinh = value; }
        }
        private string _NhanSu_TangPCChucVu;

        public string NhanSu_TangPCChucVu
        {
            get { return _NhanSu_TangPCChucVu; }
            set { _NhanSu_TangPCChucVu = value; }
        }
        private string _NhanSu_TangTNVK;

        public string NhanSu_TangTNVK
        {
            get { return _NhanSu_TangTNVK; }
            set { _NhanSu_TangTNVK = value; }
        }
        private string _NhanSu_TangTNNghe;

        public string NhanSu_TangTNNghe
        {
            get { return _NhanSu_TangTNNghe; }
            set { _NhanSu_TangTNNghe = value; }
        }
        private bool _NhanSu_KhongTNVK;

        public bool NhanSu_KhongTNVK
        {
            get { return _NhanSu_KhongTNVK; }
            set { _NhanSu_KhongTNVK = value; }
        }
        private bool _NhanSu_KhongTNNghe;

        public bool NhanSu_KhongTNNghe
        {
            get { return _NhanSu_KhongTNNghe; }
            set { _NhanSu_KhongTNNghe = value; }
        }
        private decimal _NhanSu_ThuNhapBHTN;

        public decimal NhanSu_ThuNhapBHTN
        {
            get { return _NhanSu_ThuNhapBHTN; }
            set { _NhanSu_ThuNhapBHTN = value; }
        }
        private string _NhanSu_PhuongThucBHTN;

        public string NhanSu_PhuongThucBHTN
        {
            get { return _NhanSu_PhuongThucBHTN; }
            set { _NhanSu_PhuongThucBHTN = value; }
        }
        private string _NhanSu_DoiTuongBHYT;

        public string NhanSu_DoiTuongBHYT
        {
            get { return _NhanSu_DoiTuongBHYT; }
            set { _NhanSu_DoiTuongBHYT = value; }
        }
        private decimal _NhanSu_MucTienBHYT;

        public decimal NhanSu_MucTienBHYT
        {
            get { return _NhanSu_MucTienBHYT; }
            set { _NhanSu_MucTienBHYT = value; }
        }
        private string _NhanSu_PhuongThucBHYT;

        public string NhanSu_PhuongThucBHYT
        {
            get { return _NhanSu_PhuongThucBHYT; }
            set { _NhanSu_PhuongThucBHYT = value; }
        }
        private int _NhanSu_PhongBan;

        public int NhanSu_PhongBan
        {
            get { return _NhanSu_PhongBan; }
            set { _NhanSu_PhongBan = value; }
        }
        private bool _NhanSu_DaThoiViec;

        public bool NhanSu_DaThoiViec
        {
            get { return _NhanSu_DaThoiViec; }
            set { _NhanSu_DaThoiViec = value; }
        }


    }

    public class NhanSu_Controller : Standard_Controller
    {
        #region "Contructor"
        private static NhanSu_Controller _instance;
        protected NhanSu_Controller() { }
        protected void Dispose()
        {
            _instance = null;
        }
        private static object _syncLock = new object();
        public static NhanSu_Controller Instance()
        {
            if (_instance == null)
            {
                lock (_syncLock)
                {
                    if (_instance == null)
                        _instance = new NhanSu_Controller();
                }
            }
            return _instance;
        }
        public static NhanSu_Controller Instance(String transName)
        {
            if (!String.IsNullOrEmpty(transName))
            {
                NhanSu_Controller _instanceTrans = new NhanSu_Controller();
                _instanceTrans.Trans_Name = transName;
                return _instanceTrans;
            }
            else
                return Instance();
        }
        #endregion
        public const String cs_Table_Name = "";
        public int NhanSu_Insert(NhanSu_Info eInfo)
        {
            return Globals.Object_GetValue<int>(DataConnect.ExecuteScalar(DataConnect.WorkingConnect, Procedure_Name(cs_Table_Name, "HRM_NhanSu_Insert"),
                eInfo.NhanSu_SoSoBHXH
            ,eInfo.NhanSu_HoVaTen
            ,eInfo.NhanSu_GioiTinh
            ,eInfo.NhanSu_NgaySinh == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgaySinh
            ,eInfo.NhanSu_DanToc
            ,eInfo.NhanSu_QuocGia
            ,eInfo.NhanSu_DienThoai
            ,eInfo.NhanSu_Email
            ,eInfo.NhanSu_SoCMT
            ,eInfo.NhanSu_NoiCapCMT
            ,eInfo.NhanSu_NgayCapCMT == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgayCapCMT
            ,eInfo.NhanSu_NoiKham
            ,eInfo.NhanSu_MaBenhVien
            ,eInfo.NhanSu_ChaMe
            ,eInfo.NhanSu_ThanNhanKhac
            ,eInfo.NhanSu_DiaChiKhaiSinh
            ,eInfo.NhanSu_PhuongKhaiSinh
            ,eInfo.NhanSu_QuanKhaiSinh
            ,eInfo.NhanSu_ThanhPhoKhaiSinh
            ,eInfo.NhanSu_DiaChiHoKhau
            ,eInfo.NhanSu_PhuongHoKhau
            ,eInfo.NhanSu_QuanHoKhau
            ,eInfo.NhanSu_ThanhPhoHoKhau
            ,eInfo.NhanSu_DiaChiLienHe
            ,eInfo.NhanSu_PhuongLienHe
            ,eInfo.NhanSu_QuanLienHe
            ,eInfo.NhanSu_ThanhPhoLienHe
            ,eInfo.NhanSu_SoHopDong
            ,eInfo.NhanSu_NgayKy == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgayKy
            ,eInfo.NhanSu_NgayHieuLuc == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgayHieuLuc
            ,eInfo.NhanSu_LoaiHopDong
            ,eInfo.NhanSu_ChucVu
            ,eInfo.NhanSu_LuongChinh
            ,eInfo.NhanSu_LuongKhac
            ,eInfo.NhanSu_PCChucVu
            ,eInfo.NhanSu_TNVK
            ,eInfo.NhanSu_TNNghe
            ,eInfo.NhanSu_TangLuongChinh
            ,eInfo.NhanSu_TangPCChucVu
            ,eInfo.NhanSu_TangTNVK
            ,eInfo.NhanSu_TangTNNghe
            ,eInfo.NhanSu_KhongTNVK
            ,eInfo.NhanSu_KhongTNNghe
            ,eInfo.NhanSu_ThuNhapBHTN
            ,eInfo.NhanSu_PhuongThucBHTN
            ,eInfo.NhanSu_DoiTuongBHYT
            ,eInfo.NhanSu_MucTienBHYT
            ,eInfo.NhanSu_PhuongThucBHYT
            ,eInfo.NhanSu_PhongBan
            ,eInfo.NhanSu_DaThoiViec
            ,eInfo.NhanSu_BranchID));
        }

        public bool NhanSu_Update(NhanSu_Info eInfo)
        {
            return Globals.Object_GetValue<bool>(DataConnect.ExecuteNonQuery(DataConnect.WorkingConnect, Procedure_Name(cs_Table_Name, "HRM_NhanSu_Update"),
            eInfo.NhanSu_ID
            , eInfo.NhanSu_SoSoBHXH
            , eInfo.NhanSu_HoVaTen
            , eInfo.NhanSu_GioiTinh
            , eInfo.NhanSu_NgaySinh == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgaySinh
            , eInfo.NhanSu_DanToc
            , eInfo.NhanSu_QuocGia
            , eInfo.NhanSu_DienThoai
            , eInfo.NhanSu_Email
            , eInfo.NhanSu_SoCMT
            , eInfo.NhanSu_NoiCapCMT
            , eInfo.NhanSu_NgayCapCMT == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgayCapCMT
            , eInfo.NhanSu_NoiKham
            , eInfo.NhanSu_MaBenhVien
            , eInfo.NhanSu_ChaMe
            , eInfo.NhanSu_ThanNhanKhac
            , eInfo.NhanSu_DiaChiKhaiSinh
            , eInfo.NhanSu_PhuongKhaiSinh
            , eInfo.NhanSu_QuanKhaiSinh
            , eInfo.NhanSu_ThanhPhoKhaiSinh
            , eInfo.NhanSu_DiaChiHoKhau
            , eInfo.NhanSu_PhuongHoKhau
            , eInfo.NhanSu_QuanHoKhau
            , eInfo.NhanSu_ThanhPhoHoKhau
            , eInfo.NhanSu_DiaChiLienHe
            , eInfo.NhanSu_PhuongLienHe
            , eInfo.NhanSu_QuanLienHe
            , eInfo.NhanSu_ThanhPhoLienHe
            , eInfo.NhanSu_SoHopDong
            , eInfo.NhanSu_NgayKy == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgayKy
            , eInfo.NhanSu_NgayHieuLuc == DateTime.MinValue ? (DateTime?)null : eInfo.NhanSu_NgayHieuLuc
            , eInfo.NhanSu_LoaiHopDong
            , eInfo.NhanSu_ChucVu
            , eInfo.NhanSu_LuongChinh
            , eInfo.NhanSu_LuongKhac
            , eInfo.NhanSu_PCChucVu
            , eInfo.NhanSu_TNVK
            , eInfo.NhanSu_TNNghe
            , eInfo.NhanSu_TangLuongChinh
            , eInfo.NhanSu_TangPCChucVu
            , eInfo.NhanSu_TangTNVK
            , eInfo.NhanSu_TangTNNghe
            , eInfo.NhanSu_KhongTNVK
            , eInfo.NhanSu_KhongTNNghe
            , eInfo.NhanSu_ThuNhapBHTN
            , eInfo.NhanSu_PhuongThucBHTN
            , eInfo.NhanSu_DoiTuongBHYT
            , eInfo.NhanSu_MucTienBHYT
            , eInfo.NhanSu_PhuongThucBHYT
            , eInfo.NhanSu_PhongBan
            , eInfo.NhanSu_DaThoiViec
            , eInfo.NhanSu_BranchID) > 0);
        }

        public NhanSu_Info NhanSu_GetInfo(int NhanSuID)
        {
            return CBO.FillObject<NhanSu_Info>(DataConnect.ExecuteRow(DataConnect.WorkingConnect, Procedure_Name(cs_Table_Name, "HRM_NhanSu_GetInfo"), NhanSuID));
        }

        public DataSet NhanSu_GetList(string _OrderBy, string _OrderDirection, int currPage, int pageSize, out int itemCount)
        {
            itemCount = 0;
            DataSet ds = DataConnect.ExecuteDataset(DataConnect.WorkingConnect, Procedure_Name(cs_Table_Name, "HRM_NhanSu_GetList", false), _OrderBy, _OrderDirection, currPage, pageSize);
            if (ds != null && ds.Tables.Count > 0)
                itemCount = Globals.Object_GetValue<int>(ds.Tables[1].Rows[0][0]);
            return ds;
        }

        public DataSet NhanSu_GetOne(int _NhanSuID)
        {
            DataSet ds = DataConnect.ExecuteDataset(DataConnect.WorkingConnect, Procedure_Name(cs_Table_Name, "HRM_NhanSu_GetOne", false), _NhanSuID);
            return ds;
        }
    }
}
